﻿//  Copyright (c) 2011 Ray Liang (http://www.dotnetage.com)
//  Licensed MIT: http://www.opensource.org/licenses/mit-license.php
using System.Collections.Generic;

namespace DNA.Mvc
{
    public interface IWebPageRepository:IRepository<WebPage>
    {
        /// <summary>
        /// Delete the page by specified id.
        /// </summary>
        /// <param name="id">Specified the page id for delete</param>
        void Delete(int id);

        /// <summary>
        /// Get the WebPage instance for sepecifed path.
        /// </summary>
        /// <param name="path">The path of the page.</param>
        /// <returns>The WebPage instance.</returns>
        WebPage Find(string path);

        /// <summary>
        ///  Get the WebPageRole collection by specified the page id.
        /// </summary>
        /// <param name="id">The page id.</param>
        /// <returns>A collection of the WebPageRole instances.</returns>
        string[] GetRoles(int id);

        IEnumerable<WebPageRole> GetRoles(int[] ids);

        /// <summary>
        /// Add roles to specified page.
        /// </summary>
        /// <param name="id">The web page id.</param>
        /// <param name="roles">the roles to add</param>
        void AddRoles(int id,string[] roles);

        void AddRoles(WebPage page, string[] roles);

        /// <summary>
        /// Clear roles from specified page.
        /// </summary>
        /// <param name="id">The web page id.</param>
        void ClearRoles(int id);

        /// <summary>
        /// Get the child pages for specified page id.
        /// </summary>
        /// <param name="webID">The parent web id.</param>
        /// <param name="parentID">Specified th page id.</param>
        /// <returns>The WebPages of the specified id.</returns>
        IEnumerable<WebPage> GetChildren(int webID, int parentID);

        /// <summary>
        /// Gets the page is exists by specified path
        /// </summary>
        /// <param name="path">Specified the page path</param>
        /// <returns>Return bool value</returns>
        bool IsExists(string path);

        /// <summary>
        /// Move the specified page to the new position
        /// </summary>
        /// <param name="parentID">Specified the page parent id which page belongs to.</param>
        /// <param name="id">Specified the exisits page id.</param>
        /// <param name="pos">Specified the new position</param>
        void Move(int parentID, int id, int pos);

        /// <summary>
        /// Set the page as the default page of web by specified page id.
        /// </summary>
        /// <param name="webID">Specified the website id.</param>
        /// <param name="pageID">Specified the page id</param>
        void SetToDefault(int webID,int pageID);

        WebPage Create(Web web, int parentID, WebPageTemplate template);
    }
}
